package 预习的;

import java.util.Scanner;

public class 用户登录 {
    public static void main(String[] args) {
        String username = "admin";
        String password = "123456";
        Scanner sc = new Scanner(System.in);

        for (int i = 1; i <= 3; i++) {
            System.out.println("请输入您的用户名：");
            String scusername = sc.nextLine();
            System.out.println("请输入您的密码：");
            String scpassword = sc.nextLine();

            if (username.equals(scusername) && password.equals(scpassword)) {
                System.out.println("登陆成功");
            } else {
                if (i == 3) {
                    System.out.println("今天的三次机会已经用完了 明天再来吧");
                } else {
                    System.out.println("输入错误，你还有" + (3 - i) + "次机会");
                }
            }

        }
    }
}
